package xjtu.sad.zbsj.user.forget.impl;

import xjtu.sad.zbsj.user.forget.ForgetDto;
import xjtu.sad.zbsj.user.forget.ForgetService;
import xjtu.sad.zbsj.user.forget.dao.ForgetDao;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * @author lkm
 */
@Slf4j
@Service
@Transactional
public class ForgetServiceImpl implements ForgetService {

    @Resource
    private ForgetDao forgetDao;


    @Override
    public boolean checkCount(ForgetDto dto) {

        int cnt=forgetDao.findCntByEml(dto);
        return cnt==1;
    }

    @Override
    public void updatePwd(ForgetDto dto) {

        String plain = dto.getU_pwd();
        System.out.println("新密码为++++"+plain);
        dto.setU_pwd(plain);
        //dto.setU_pwd(Md5Utils.string2Md5(plain));
        forgetDao.updatePwd(dto);

    }



}
